package com.northwest_man.refactor_tool;

import java.io.File;
import java.util.List;

/**
 * 删除迁移到新module的文件
 */
public class DeleteOriginalFileByNewFile {
    public static void main() {
        FileUtil.recursionFolder(new File(Constants.pastedParentFolder), null, new Handler() {
            @Override
            public Object doHandle(File curFile, List allFileAbsolutePath) {
                try {
                    final String fileNameWithoutSuffix = curFile.getAbsolutePath().substring(Constants.pastedParentFolder.length());

                    final String fromFileAPath = Constants.copyParentFolder + fileNameWithoutSuffix;
                    final boolean success = new File(fromFileAPath).delete();
                    if (!success) {
                        System.out.println("删除失败：" + fromFileAPath);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
    }
}
